﻿using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.Core.Office.VariantTypes
{
    [XmlRoot("", Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
    public class VectorContainer : XmlSerializable
    {
        [XmlElement("vector", Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
        public Vector Element { get; set; }

        public VectorContainer() { }
    }

    [XmlRoot("array", Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
    public class VTArray : XmlSerializable, IVariantType
    {
        [XmlAttribute("lBounds", Form = XmlSchemaForm.Qualified)]
        public int LowerBounds { get; set; }

        [XmlAttribute("uBounds", Form = XmlSchemaForm.Qualified)]
        public int UpperBounds { get; set; }

        [XmlAttribute("baseType", Form = XmlSchemaForm.Qualified)]
        public ST_ArrayBaseType BaseType { get; set; }

        [XmlElement("", Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
        public XmlList<IArrayType> Elements { get; set; }

        public VTArray()
        {
            Elements = new XmlList<IArrayType>();
        }
    }

    [XmlRoot("variant", Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
    public class Variant : XmlSerializable, IArrayType, IVectorType
    {
        [XmlElement("", Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
        public IVariantType Element { get; set; }

        public Variant()
        {
        }
    }

    [XmlRoot("vector", Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
    public class Vector : XmlSerializable, IVariantType
    {
        [XmlAttribute("baseType", Form = XmlSchemaForm.Qualified)]
        public ST_VectorBaseType BaseType { get; set; }

        [XmlAttribute("size", Form = XmlSchemaForm.Qualified)]
        public uint Size { get; set; }

        [XmlElement("", Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")]
        public XmlList<IVectorType> Elements { get; set; }

        public Vector()
        {
            Elements = new XmlList<IVectorType>();
        }
    }
}
